package com.orange.demo.controller;

import com.orange.demo.mapper.UserMapper;
import com.orange.demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
    //依赖注入
    @Autowired
    UserMapper userMapper;

    @GetMapping("/templates")
   public String test(HttpServletRequest request) {
        //逻辑处理
        request.setAttribute("key", "我是动态的乐乐呀！");
        return "/index";
    }

    @GetMapping("/html")
    public String html() {
        return "redirect:/index.html";
    }
}
